import React, { Suspense } from 'react';
import { BrowserRouter } from 'react-router-dom';
import { RenderRouters, routeConfig } from './routes';
import { env } from '@/config';
import Loading from './components/loading/Loading';

function App() {
    let preffix: string = '';
    if (process.env.NODE_ENV === 'production') {
        // 生产环境下的路径配置
        preffix = 'screen/business';
    }

    console.info('env', env);

    return (
        <BrowserRouter basename={preffix}>
            <Suspense fallback={<Loading />}>
                <RenderRouters config={routeConfig}></RenderRouters>
            </Suspense>
        </BrowserRouter>
    );
}

export default App;
